home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / Http Server / •OT_Classes / TNetworkEventHandler.h < prev    next >
Encoding:
Text File  |  1996-01-11  |  1.6 KB  |  62 lines  |  [TEXT/CWIE]

  1. //    TNetworkEventHandler.h - Macintosh OpenTransport network class object
  2. // 
  3. // Apple Macintosh Developer Technical Support
  4. // Written by:  Vinne Moscaritolo
  5. //
  6. //  Copyright (work in progress)  Apple Computer, Inc All rights reserved.
  7. //
  8. // You may incorporate this sample code into your applications without
  9. // restriction, though the sample code has been provided "AS IS" and the
  10. // responsibility for its operation is 100% yours.  However, what you are
  11. // not permitted to do is to redistribute the source as "DSC Sample Code"
  12. // after having made changes. If you're going to re-distribute the source,
  13. // we require that you make it clear in the source that the code was
  14. // descended from Apple Sample Code, but that you've made changes.
  15. // 
  16.  
  17. #ifndef _H_TNETWORKEVENTHANDLER
  18. #define _H_TNETWORKEVENTHANDLER
  19.  
  20. #include <OpenTransport.h>
  21. #include "TNetworkEvent.h"
  22. #include "TNetworkException.h"
  23.  
  24. //
  25. // TNetworkEventHandler  - OpenTransport Network Event Handler class 
  26. //
  27. class TNetworkEventHandler : private TLink
  28. {
  29.  
  30. //     CONSTRUCTORS AND DESTRUCTORS
  31. public:
  32.             TNetworkEventHandler();
  33.     virtual    ~TNetworkEventHandler();
  34.     
  35. // HIGH LEVEL FUNCTIONS
  36. public:
  37.             void         ProcessEvents();
  38.             TLifo*    GetEventQueue()     { return  &fEventQueue;  };
  39.             
  40. // ABSTRACT FUNCTIONS
  41.     virtual void     HandleEvent(TNetworkEvent* ) = 0;
  42.  
  43. // CLASS FUNCTIONS
  44.     static     void     ScanEventHandlerQueue();
  45.  
  46. // PROTECTED FIELDS
  47. private:
  48.     TLifo            fEventQueue;
  49.  
  50. // CLASS VARIABLES
  51. private:
  52.     static     TList    fgActiveList;
  53.  
  54. };
  55.  
  56. // USEFUL MACROS
  57.  
  58. #define QUEUE_NET_EVENT(_who_, _event_, _result_, _parm_) \
  59.                 _who_->GetEventQueue()->Enqueue( new  TNetworkEvent(_event_, _result_, _parm_))
  60.  
  61. #endif
  62.